home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0635.ZIP / GETDATE.INC < prev    next >
Text File  |  1987-07-23  |  755b  |  35 lines

  1. Type
  2.   MG_DAteStr = String[8];
  3.  
  4. Function CurrentDate : MG_DateStr;
  5. {** Returns a date string from DOS in the format '99/99/99' **}
  6. Type
  7.   RegPack = Record
  8.             AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer;
  9.             End;
  10. Var
  11.   Registers      : RegPack;
  12.   Month,Day,Year : Integer;
  13.   MStr,DStr      : String[2];
  14.   YStr           : String[4];
  15.  
  16. Begin
  17. With Registers do
  18.   AX := $2A shl 8;
  19. MSDos(Registers);
  20. With Registers do
  21.   Begin
  22.   Month := Hi(DX);
  23.   Day   := Lo(DX);
  24.   Year  := CX;
  25.   Str(Month:2,MStr);
  26.   If MStr[1] = ' ' then
  27.     MStr[1] := '0';
  28.   Str(Day:2,DStr);
  29.   If DStr[1] = ' ' then
  30.     DStr[1] := '0';
  31.   Str(Year:2,YStr);
  32.   End;
  33. CurrentDate := Concat(MStr,'/',DStr,'/',Copy(YStr,3,2));
  34. End; {CurrentDate}
  35.